﻿using System;
using System.Collections.Generic;
using System.Text;

namespace StudentList
{
    public class StudentFactory
    {

        private static string _picFormatStringFile = @".\pics\{0}.jpg";
        private static string _picFormatString = @"http://ems.sit.edu.cn:85/files_upload/photo/student/{0}.jpg";
        private static string _picFormatStringHttp = @"http://ems.sit.edu.cn:85/files_upload/photo/student/{0}.jpg";
        public static Student GetInstance()
        {
            Student s = new Student();
            s.PicFormatString = _picFormatString;
            return s;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="locationType"></param>
        public static void SetDefaultPicSource(string locationType)
        {
            switch (locationType)
            {
                case "local":
                    _picFormatString = _picFormatStringFile;
                    break;
                case "web":
                    _picFormatString = _picFormatStringHttp;
                    break;
                default:
                    _picFormatString = _picFormatStringFile;
                    break;
            }
        }
    }
}
